﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using DataAccessClasses;

namespace BUSINESS_OBJECT
{
    class PAYMENT_HISTORY
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _ID = -99;
        private string _COMPANY_NAME = "";
        private long _PAYMENT = -99;
        private string _DATE = "1/1/1800";
        private bool _ISDELETED = false;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public long ID
        {
            get
            {
                return _ID;
            }
            set
            {
                _ID = value;
            }
        }
        
        public string COMPANY_NAME
        {
            get
            {
                return _COMPANY_NAME;
            }
            set
            {
                _COMPANY_NAME = value;
            }
        }
        public long PAYMENT
        {
            get
            {
                return _PAYMENT;
            }
            set
            {
                _PAYMENT = value;
            }
        }
        public string DATE
        {
            get
            {
                return _DATE;
            }
            set
            {
                _DATE = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@ID", ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@PAYMENT", PAYMENT, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@DATE", DATE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4};
                return DAC.Save("PAYMENT_HISTORY_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long ID, string COMPANY_NAME, long PAYMENT, string DATE, bool ISDELETED, string PARAANDOR)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@ID", ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@COMPANY_NAME", COMPANY_NAME, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@PAYMENT", PAYMENT, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@DATE", DATE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@ISDELETED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@PARAANDOR", PARAANDOR, DbType.AnsiString, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5};
                DataTable dt1 = DAC.Select("PAYMENT_HISTORY_GET", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
